<?php
/*
==========================================
* 插件安装程序
==========================================
* Copyright (c) 2012 伯仁网络 All rights reserved.
* Authors: YinHailin
* $Id: Install.php 1 2014-01-03 07:55:45Z YinHailin $
==========================================
*/

$dbPrefix = C('DB_PREFIX');
$sql = <<<EOF

CREATE TABLE `{$dbPrefix}article_sort` (
  `id` int(3) NOT NULL AUTO_INCREMENT,
  `sort_name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `status` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
  `parent_id` int(3) NOT NULL DEFAULT '0',
  `sequence` int(3) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO `{$dbPrefix}article_sort` (`id`, `sort_name`, `status`, `parent_id`, `sequence`) VALUES
(1, '默认分类', '1', '0', '0');

CREATE TABLE `{$dbPrefix}article` (
  `id` int(8) NOT NULL AUTO_INCREMENT,
  `article_name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `status` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `sequence` int(3) NOT NULL DEFAULT '0',
  `sort_id` int(3) NOT NULL DEFAULT '1',
  `article_pic` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `content` text COLLATE utf8_unicode_ci NOT NULL,
  `tags` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '聚合标签',
  `add_time` int(10) NOT NULL,
  `click_number` int(8) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

EOF;
plugin_excute($sql);